package com.qf.smsplatform.controller;
/*2021/10/31*/

import com.github.pagehelper.PageInfo;
import com.qf.smsplatform.dto.R;
import com.qf.smsplatform.pojo.TClientBusiness;
import com.qf.smsplatform.service.TClientBusinessService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.ibatis.annotations.Delete;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @YuTao
 */
@RestController
@RequestMapping("/business")
@Api(tags = "客户信息表")
public class TClientBusinessController {

    private TClientBusinessService tClientBusinessService;
    @Autowired
    public void settClientBusinessService(TClientBusinessService tClientBusinessService) {
        this.tClientBusinessService = tClientBusinessService;
    }
    @GetMapping("/page")
    @ApiOperation("分页查询相关信息")
    public R selectPage(int pageNum, int pageSize){
        PageInfo<TClientBusiness> pageInfo = tClientBusinessService.selectPage(pageNum, pageSize);
        return R.setOk(pageInfo);
    }
    @GetMapping("/one")
    @ApiOperation("查询单个信息")
    public R selectByKey(Long id){
        TClientBusiness tClientBusiness = tClientBusinessService.selcetById(id);
        return R.setOk(tClientBusiness);
    }
    @PostMapping("/insert")
    @ApiOperation("添加一条信息")
    public R insert(TClientBusiness tClientBusiness){
        tClientBusinessService.insertBusiness(tClientBusiness);
        return R.setOk();
    }
    @PostMapping("/update")
    @ApiOperation("更新相关信息")
    public R update(TClientBusiness tClientBusiness){
        tClientBusinessService.updateBusiness(tClientBusiness);
        return R.setOk();
    }
    @DeleteMapping("/delete")
    @ApiOperation("删除相关信息")
    public R delete(int id){
        tClientBusinessService.deleteBusiness(id);
        return R.setOk();
    }





}
